package com.syl.starter.mp.generate;

import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @author syl
 * @create 2019-05-20 23:21
 **/
@Accessors(chain = true)
public abstract class BaseCodeGenerate {
    public static final String JAVA_ROOT_PATH = "src\\main\\java";
    public String mapperRootPath = "";
    /**
     * 项目路径
     */
    @Setter
    protected String projectPath;
    /**
     * 表名称
     */
    @Setter
    protected String[] tableNames;
    /**
     * 作者
     */
    protected String author;
    /**
     * mapper 后缀名称
     */
    protected String mapperSuffixName = "GenerateMapper";
    /**
     * 二级缓存class
     */
    @Setter
    protected String cacheClass;
    /**
     * 表名称前缀 去除
     */
    @Setter
    protected String[] tablePrefixWipes;
    @Setter
    protected DataSourceConfig dataSourceConfig;
    @Setter
    protected PackageConfig packageConfig;

    abstract public void start() throws Exception;

    protected boolean isEmpty(CharSequence cs) {
        return cs == null || cs.length() == 0;
    }

}
